

#ifndef CARTOGRAPHER_MAPPING_INTERNAL_2D_RAY_CASTING_H_
#define CARTOGRAPHER_MAPPING_INTERNAL_2D_RAY_CASTING_H_

#include <vector>

#include "mapping/2d/probability_grid.h"
#include "mapping/sensor/range_data.h"

namespace cartographer {
namespace mapping {

// For each ray in 'range_data', inserts hits and misses into
// 'probability_grid'. Hits are handled before misses.
// 进行栅格地图构建的时候需要用到的raytrace，基本算法为bresenham2d算法．
// 计算hit_visitor 和 miss_visitor，先处理hits
void CastRays(const sensor::RangeData &range_data, const std::vector<uint16_t> &hit_table,
              const std::vector<uint16_t> &miss_table, bool insert_free_space, ProbabilityGrid *probability_grid);

}  // namespace mapping
}  // namespace cartographer

#endif  // CARTOGRAPHER_MAPPING_INTERNAL_2D_RAY_CASTING_H_
